;macro pmovzxbd arg1,arg2
;{
;     push       ebp            ; sth invalid
;     sub        esp,32
;     mov        ebp,esp
;     and        ebp,-16
;     .l_movzxbd equ [ebp-16]
;     movaps     .l_movzxbd,arg2
;     xorps      arg1,arg1
;     punpcklbw  arg1,.l_movzxbd
;     movaps     .l_movzxbd,arg1
;     xorps      arg1,arg1
;     punpcklwd  arg1,.l_movzxbd
;     add        esp,32
;     pop        ebp
;
;}

macro dpps arg1,arg2,arg3
{
     if  arg3 = 01110111b
       mulps  arg1,arg2
       andps  arg1,[zero_hgst_dd]
       haddps arg1,arg1
       haddps arg1,arg1
       andps  arg1,[zero_hgst_dd]

     else if arg3 = 01110001b
       mulps  arg1,arg2
       andps  arg1,[zero_hgst_dd]
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11111100b
       add    esp,4




     else if arg3 = 01110010b
       mulps  arg1,arg2
       andps  arg1,[zero_hgst_dd]
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11110011b
       add    esp,4

     else if arg3 = 01110100b
       mulps  arg1,arg2
       andps  arg1,[zero_hgst_dd]
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11001111b
       add    esp,4

     else if arg3 = 01111000b
       mulps  arg1,arg2
       andps  arg1,[zero_hgst_dd]
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,00111111b
       add    esp,4

     else if  arg3 = 11110111b
       mulps  arg1,arg2
       haddps arg1,arg1
       haddps arg1,arg1
       andps  arg1,[zero_hgst_dd]

     else if arg3 = 11110001b
       mulps  arg1,arg2
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11111100b
       add    esp,4




     else if arg3 = 11110010b
       mulps  arg1,arg2
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11110011b
       add    esp,4

     else if arg3 = 11110100b
       mulps  arg1,arg2
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,11001111b
       add    esp,4

     else if arg3 = 11111000b
       mulps  arg1,arg2
       haddps arg1,arg1
       haddps arg1,arg1
       push   eax
       movss  [esp],arg1
       xorps  arg1,arg1
       movlps arg1,[esp]
       shufps arg1,arg1,00111111b
       add    esp,4

      else if arg3 = 0xff
        mulps  arg1,arg2
        haddps arg1,arg1
        haddps arg1,arg1
      else

        dpps arg1,arg2,arg3
      end if
}

macro pcmpgdq arg1,arg2
{

      push     eax
      pcmpeqd  arg1,arg2
      movmskps eax,arg1
      or       eax,11b
      cmp      eax,11b
      je       .yes_pcmeqdq
      xorps    arg1,arg1
    .yes_pcmeqdq:
      pop      eax

}
macro popcnt   arg1,arg2
{

    push        dword 32
    push        arg2
    push        dword 0
  @@:
    shr         dword [esp+4],1
    adc         dword [esp],0
    dec         dword [esp+8]
    jnz         @b
    pop         arg1
    add         esp,8

 }


